{% extends "catalog/base_generic.html" %}

{% block content %}
<h1>所有书籍</h1>

{% if book_list %}
  <ul class="list-unstyled">
    {% for book in book_list %}
    <li class="mb-3 pb-2 border-bottom">
      <h3><a href="{{ book.get_absolute_url }}">{{ book.title }}</a></h3>
      <p><strong>作者:</strong> {{ book.author }}</p>
      <p><strong>流派:</strong>
        {% for genre in book.genre.all %}{{ genre }}{% if not forloop.last %}, {% endif %}{% endfor %}
      </p>
    </li>
    {% endfor %}
  </ul>

  <!-- 分页功能，通过 include 引入统一的分页模板 -->
  {% include "catalog/pagination.html" %}

{% else %}
  <p>图书馆中暂无书籍记录</p>
{% endif %}
{% endblock %}